import storage from '@/utils/storage';

const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/',
        component: () => import('@/views/home/index.vue'),
      },
      {
        path: '/category/:id',
        component: () => import('@/views/category/index.vue'),
      },
      {
        path: '/category/sub/:id',
        component: () => import('@/views/category/subCategory.vue'),
      },
      {
        path: '/product/:id',
        component: () => import('@/views/goods/index.vue'),
      },
      {
        path: '/cart',
        component: () => import('@/views/cart/index.vue')
      },
      {
        path: '/member/checkout',
        component: () => import('@/views/pay/checkout.vue')
      }, {
        path: '/member/pay',
        component: () => import('@/views/pay/index.vue')
      },
      {
        path: '/pay/callback',
        component: () => import('@/views/pay/result.vue')
      },
      {
        path: '/member',
        component: () => import('@/views/user/layout.vue'),
        children: [
          { path: '/member', component: () => import('@/views/user/index.vue') },
          { path: '/member/order', component: () => import('@/views/user/order.vue') },
          { path: '/member/order/:id', component: () => import('@/views/user/order-detail.vue') },
          { path: '/member/address', component: () => import('@/views/user/address.vue') },
          { path: '/member/browsehistory', component: () => import('@/views/user/history.vue') }
        ]
      }
    ],
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
  },
  {
    path: '/login/callback',
    component: () => import('@/views/login/callback.vue'),
  },
];

export default routes;
